module project.project;

import vfs.document;
import project.directory;
import model.imodel;

import std.path;
import std.file;

class Project {
    private string myName;
    private string myPath;
    private Directory myRootDirectory;

    public synchronized this(in string path, in bool createFlag = false) {
        if (!exists(path)) {
            throw new FileException(path, "Project file not found");
        }
    	myName = basename(path, ".json");
        myPath = dirname(path);
        myRootDirectory = new Directory(this);
        if (createFlag) {
            mkdirRecurse(myPath);
            write(path, IModel.getInstance().getDefaultProjectConfiguration());
        }
    }

    public string getPath() const {
        return myPath;
    }

    public void open() shared {
    }

    public ~this() {
    }
}
